package com.qianfeng.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qianfeng.pojo.Dept;
import com.qianfeng.service.DeptService;

@Controller
public class DeptController {
 
	@Autowired
	private DeptService deptService;
	
	@RequestMapping("/finddept")
	@ResponseBody
	public Dept findDept(String name) { //当输入http://localhost:8080/finddept?name=部门2222时会将name的值传给形参name
		return deptService.findDept(name);
	}
	
	@RequestMapping("/adddept")
	@ResponseBody
	public String addDept() {
		Dept dept= new Dept();
		dept.setName("sb整合my注解方式");
		deptService.saeDept(dept);
		return "success";
	}
}
